<html><head><title>ToolBar.pb</title></head>
<body bgcolor="#FFFFDF" link="#009999" vlink="#006666" alink="#006666">
<pre><font face="Courier New, Courier, mono"size="2"><font color="#006666">;
</font><font color="#006666">; ------------------------------------------------------------
</font><font color="#006666">;
</font><font color="#006666">;   PureBasic - ToolBar example file
</font><font color="#006666">;
</font><font color="#006666">;    (c) Fantaisie Software
</font><font color="#006666">;
</font><font color="#006666">; ------------------------------------------------------------
</font><font color="#006666">;
</font>
<font color="#006666">UsePNGImageDecoder</font>()

<b><font color="#006666">If</font></b> <font color="#006666">OpenWindow</font>(0, 100, 200, 195, 260, "ToolBar example", <font color="#924B72">#PB_Window_SystemMenu</font> | <font color="#924B72">#PB_Window_SizeGadget</font>)

  <b><font color="#006666">If</font></b> <font color="#006666">CreateToolBar</font>(0,<font color="#006666"> WindowID</font>(0))
<font color="#006666">    ToolBarImageButton</font>(0,<font color="#006666"> LoadImage</font>(0, <font color="#924B72">#PB_Compiler_Home</font> + "examples/sources/Data/ToolBar/New.png"))
<font color="#006666">    ToolBarImageButton</font>(1,<font color="#006666"> LoadImage</font>(0, <font color="#924B72">#PB_Compiler_Home</font> + "examples/sources/Data/ToolBar/Open.png"))
<font color="#006666">    ToolBarImageButton</font>(2,<font color="#006666"> LoadImage</font>(0, <font color="#924B72">#PB_Compiler_Home</font> + "examples/sources/Data/ToolBar/Save.png"))
    
<font color="#006666">    ToolBarSeparator</font>()

<font color="#006666">    ToolBarImageButton</font>(3,<font color="#006666"> LoadImage</font>(0, <font color="#924B72">#PB_Compiler_Home</font> + "examples/sources/Data/ToolBar/Cut.png"))
<font color="#006666">    ToolBarToolTip</font>(0, 3, "Cut")
    
<font color="#006666">    ToolBarImageButton</font>(4,<font color="#006666"> LoadImage</font>(0, <font color="#924B72">#PB_Compiler_Home</font> + "examples/sources/Data/ToolBar/Copy.png"))
<font color="#006666">    ToolBarToolTip</font>(0, 4, "Copy")
    
<font color="#006666">    ToolBarImageButton</font>(5,<font color="#006666"> LoadImage</font>(0, <font color="#924B72">#PB_Compiler_Home</font> + "examples/sources/Data/ToolBar/Paste.png"))
<font color="#006666">    ToolBarToolTip</font>(0, 5, "Paste")
    
<font color="#006666">    ToolBarSeparator</font>()

<font color="#006666">    ToolBarImageButton</font>(6,<font color="#006666"> LoadImage</font>(0, <font color="#924B72">#PB_Compiler_Home</font> + "examples/sources/Data/ToolBar/Find.png"))
<font color="#006666">    ToolBarToolTip</font>(0, 6, "Find a document")
  <b><font color="#006666">EndIf</font></b>


  <b><font color="#006666">If</font></b> <font color="#006666">CreateMenu</font>(0,<font color="#006666"> WindowID</font>(0))
<font color="#006666">    MenuTitle</font>("Project")
<font color="#006666">      MenuItem</font>(0, "New")
<font color="#006666">      MenuItem</font>(1, "Open")
<font color="#006666">      MenuItem</font>(2, "Save")
  <b><font color="#006666">EndIf</font></b>
  
<font color="#006666">  DisableToolBarButton</font>(0, 2, 1) <font color="#006666">; Disable the button '2'
</font>  
  <font color="#006666">;
</font>  <font color="#006666">; The event loop. A ToolBar event is like a Menu event (as tools are shortcut for menu the most
</font>  <font color="#006666">; of the time). This is handy, as if the ToolBar buttons and the MenuItem have the same ID, then
</font>  <font color="#006666">; the same operation can be done on both action without any adds..
</font>  <font color="#006666">;
</font>  
  <b><font color="#006666">Repeat</font></b>
    Event =<font color="#006666"> WaitWindowEvent</font>()

    <b><font color="#006666">Select</font></b> Event
    
      <b><font color="#006666">Case</font></b> <font color="#924B72">#PB_Event_Menu</font>
<font color="#006666">        MessageRequester</font>("Information", "ToolBar or Menu ID: "+<font color="#006666">Str</font>(<font color="#006666">EventMenu</font>()), 0)
      
      <b><font color="#006666">Case</font></b> <font color="#924B72">#PB_Event_CloseWindow</font>  <font color="#006666">; If the user has pressed on the close button
</font>        Quit = 1
        
    <b><font color="#006666">EndSelect</font></b>

  <b><font color="#006666">Until</font></b> Quit = 1
  
<b><font color="#006666">EndIf</font></b>

<b><font color="#006666">End</font></b>   <font color="#006666">; All resources are automatically freed
</font>   </font></pre>
</body></html>
